home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1994-11-21 | 9.0 KB | 238 lines | [ TEXT/KAHL]
// ============================================================================= // SOUNDEFFECTS MODULES HEADER - VERSION 1.0 - NOVEMBER 1994 // ©1994 Alberto Ricci <ricci@pmn.it> <fricci@polito.it> // Don’t forget to send me any cool effect modules you create! // This text looks best in monaco 9 font, 4 spaces per tab, no wrapping #ifndef _H_glue #define _H_glue #if defined(powerc) || defined (__powerc) #pragma options align=mac68k #endif // ============================================================================= // MESSAGES (sent to the module): Corresponding action you must take (Glue.c will handle all this for you) #define kMsgRun 'Mrun' // run the effect without showing any settings dialog. #define kMsgSettings 'Mset' // let the user change any settings specific to your // module, if there are any. #define kMsgSettingsRun 'Msar' // let the user change any setting, then run the effect. #define kMsgHeadersVers 'Mhvr' // store the value of kHeadersVersion into the long // word pointed to by the GluePtr parameter, then // return noErr. #define kMsgAbout 'Minf' // do whatever you want to describe your effect module. // ============================================================================= // RECORD DEFINITIONS: typedef struct // There is one of these structures for each channel in the sound. { Handle chan; // You will normally access the channel handle like this: // myChannelHandle = (*modInfo->hands)[channelNumber].chan; // with channelNumber ranging from 0 to modInfo->numChans - 1. unsigned long size; // size is the number of bytes, not samples. } SEChanRec, *SEChanPtr, **SEChanHandle; typedef struct { long outVol[1]; } ChanAttrsRec, *ChanAttrsPtr, **ChanAttrsHandle; #define kHeadersVersion 1 // current version of callbacks typedef struct // items marked as read-only cannot be changed directly { // by the module. Use the callbacks instead. short version; short refNum; StringPtr name; WindowPtr parentWind; SEChanHandle hands; ChanAttrsHandle outModes; // read-only unsigned long selSt; unsigned long selEnd; unsigned long loopSt; unsigned long loopEnd; Fixed rate; short bps; short numChans; short firstSelCh; short lastSelCh; Byte baseFreq; short doExtend; short units; } ModParamsRec, *ModParamsPtr, **ModParamsHandle; typedef struct ModAboutRec { short version; short refNum; WindowPtr parentWind; StringHandle name; } ModAboutRec, *ModAboutPtr, **ModAboutHandle; typedef struct { short type; ProcPtr proc; long param; } ItemInfoRec, *ItemInfoPtr, **ItemInfoHandle; // This structure is used by the GetMachineInfo callback. #define kCurMachineRecVers 1 typedef struct MachineRec { short machineRecVers; // kCurMachineRecVers Boolean hasFPU; // 01 Boolean hasColorQD; // 02 all these flags are automatically set up by SoundEffects Boolean has32BitQD; // 03 so the modules don't have to call Gestalt all the time Boolean hasQuickTime; // 04 Boolean hasSoundManager3; // 05 Boolean hasSoundInputDevice; // 06 Boolean hasStereoOutput; // 07 Boolean hasStereoInput; // 08 Boolean mixesStereoOutputToMono; // 09 Boolean hasPlayAndRecord; // 10 Boolean has16BitSoundIO; // 11 Boolean hasMultipleChannels; // 12 } MachineRec, *MachinePtr, **MachineHandle; // Declare a struct for the module’s settings in your header file as // struct ModSettingsRec {…}; the struct should contain any parameters needed by your // effect when it runs, and it can be retrieved by the module with the glue routine // LoadEffectSettings. typedef struct ModSettingsRec ModSettingsRec; typedef ModSettingsRec *ModSettingsPtr; typedef ModSettingsRec **ModSettingsHandle; typedef pascal void (*ModSetInitProcPtr)(DialogPtr); typedef struct GlueRec { short glueVers; // version 1 callbacks /* progress bar */ pascal void (*ModSetupProgress) (ModParamsPtr myInfo, short *timeToCallProgress, StringHandle textStr); pascal OSErr (*ModShowProgress) (unsigned long cur, unsigned long total, short *timeToCallProgress, Boolean canCancel); pascal void (*ModCloseProgress) (void); pascal WindowPtr (*GetProgressWind) (void); /* effect preferences */ pascal OSErr (*LoadEffectSettings) (StringPtr signature, ModSettingsHandle *myHand); pascal OSErr (*SaveEffectSettings) (StringPtr signature, ModSettingsHandle *myHand); pascal short (*GetEffectSettingsRefNum) (void); /* user setups */ pascal OSErr (*ModDoSettingsDialog) (ModParamsPtr modInfo, ItemInfoHandle myItemInfo, Boolean withSetups, ModalFilterProcPtr custFilterProc, ProcPtr custItemHandler, ModSetInitProcPtr initProc); pascal short (*ModGetSetupsNumber) (ModParamsPtr modInfo); pascal OSErr (*ModGetSetup) (ModParamsPtr modInfo, short num, Handle *mySetup); pascal OSErr (*ModGetSetupName) (ModParamsPtr modInfo, short num, StringPtr myStr); pascal OSErr (*ModSetSetup) (ModParamsPtr modInfo, short num, Handle mySetup, StringPtr myName); pascal OSErr (*ModDeleteSetup) (ModParamsPtr modInfo, DialogPtr myDlog, short itemNum, short num); pascal OSErr (*ModSetupCreateMenu) (ModParamsPtr modInfo, DialogPtr myDlog, short itemNum); pascal OSErr (*ModSetupSwitchCustom) (ModParamsPtr modInfo, DialogPtr myDlog, short itemNum, Boolean addCustom); /* generic stuff */ pascal OSErr (*GetMachineInfo) (MachinePtr *infoPtr); pascal short (*AskDoExtend) (void); pascal void (*ModInitRandSeed) (void); /* dialog utilities */ pascal short (*ApplWindowsUpdate) (WindowPtr theWind); pascal short (*ApplWindowsActivate) (EventRecord *passEvt); pascal void (*ModConvertToUnits) (ModParamsPtr modInfo, StringPtr destStr, unsigned long srcVal, short newUnits); pascal void (*ModConvertToBytes) (ModParamsPtr modInfo, StringPtr srcStr, unsigned long *destVal, short newUnits); /* obtaining information */ pascal long (*GetBytesToProcess) (ModParamsPtr myInfo); pascal OSErr (*ModMaxChSize) (ModParamsHandle modData, unsigned long *size); pascal OSErr (*ModMaxRelChSize) (ModParamsHandle modData, unsigned long *size); pascal OSErr (*ModGetPeak) (ModParamsHandle modData, unsigned long *peak, unsigned long *pos); pascal void (*ModGetSampleValueLimits) (short bps, signed long *min, signed long *max); pascal unsigned long(*ModGetOffsToSndHeader) (Handle sndHandle); pascal unsigned long(*ModGetOffsToSndData) (Handle sndHandle); /* utilities */ pascal Boolean (*ModToggleInputLevel) (Boolean on); pascal OSErr (*ModDrawWave) (ModParamsPtr modInfo, Rect *bounds, unsigned long maxSize, unsigned long firstByte, unsigned long zoom, short firstCh, short lastCh); pascal OSErr (*ModShowError) (ModParamsPtr modInfo, short errNum, Boolean withCancel); /* channels stuff */ pascal OSErr (*ModAddNewChannel) (ModParamsHandle modData, short where); pascal OSErr (*ModDelChannel) (ModParamsHandle modData, short chan); pascal short (*ModGetChannelPan) (ChanAttrsHandle chAttrs, short channel, Boolean leftOne); pascal void (*ModSetChannelPan) (ChanAttrsHandle chAttrs, short channel, short leftPan, short rightPan); /* simple actions */ pascal OSErr (*ModSilenceOut) (ModParamsHandle modData, short chSt, short chEnd, unsigned long st, unsigned long end); /* resampling */ pascal OSErr (*ModResampleSoundBits) (ModParamsHandle modData, short newBps); pascal OSErr (*ModResampleSoundRate) (ModParamsHandle modData, Fixed newRate); /* new document creation */ pascal OSErr (*ModNewDocument) (ModParamsHandle *modData); pascal OSErr (*ModChangeNewDocument) (ModParamsHandle modData); } GlueRec, *GluePtr, **GlueHandle; // ============================================================================= // ROUTINE PROTOTYPES: pascal OSErr main (OSType message, ModParamsPtr modInfo, GluePtr glue68k, GluePtr gluePPC); pascal OSErr effect (ModParamsPtr modInfo, GluePtr glue, ModSettingsHandle *prefs); pascal OSErr settings (ModParamsPtr modInfo, GluePtr glue, ModSettingsHandle *prefs); pascal OSErr about (ModAboutPtr modInfo); pascal OSErr GetModSettings (ModParamsPtr modInfo, GluePtr glue, ModSettingsHandle *prefs); long SetupEffectWorld (void); void RestoreEffectWorld (long world); // ============================================================================= // RESULT CODES (returned by the module): enum { kModNoError = noErr, // no error kModCancel = userCanceledErr, // return this when the module didn’t do anything. kModGenericError = 1, // return positive results if the module left the data untouched. kModNotEnoughMemory, kModCouldntLoadMyRes = 23, kModUnknownMessage = 30, // SoundEffects will look for a 'STR#' resource, ID=1000, in the module. // If the string with index equal to the absolute value of the returned // result. kTellGenericError = -1, // return negative results if the module changed some data. kTellNotEnoughMemory = -2, kTellCouldntLoadMyRes = -23 }; // returned by the settings routine: enum { kModHasNoSettings = 1 }; #if defined(powerc) || defined (__powerc) #pragma options align=reset #endif #endif